package com.aaa.security.handler;

import com.aaa.common.vo.Result;
import com.aaa.security.exception.PermissionException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @program: qy156-education-cloud
 * @description:
 * @author: 闫克起2
 * @create: 2022-12-02 15:26
 **/
@RestControllerAdvice //标记该类为全局异常处理类
public class MyGlobleHandler {

    //如果你抛出PermissionException，则有该方法处理这个异常
    @ExceptionHandler(value = PermissionException.class)
    public Result<String> permissonException(PermissionException e){
         return new Result<String>(4001,e.getMessage());
    }
}
